package com.charlotte.study.gupao.state.gper;

/**
 * @author junjie.ding
 * @date 2020/3/20
 */
public class AppContext {

    public final UserState LOGIN_STATE = new LoginState();

    public final UserState UN_LOGIN_STATE = new UnLoginState();

    private UserState currentState = UN_LOGIN_STATE;
    {
        LOGIN_STATE.setContext(this);
        UN_LOGIN_STATE.setContext(this);
    }

    public void setCurrentState(UserState currentState) {
        this.currentState = currentState;
    }

    public void favorite(){
        this.currentState.favorite();
    }

    public void comment(String comment){
        this.currentState.comment(comment);
    }
}
